<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>员工回访</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .table > tbody > tr > td {
            height: 35px;
            max-height: 44px;
            overflow: hidden;
        }

        .td-value span.lineOne {
            overflow: hidden;
            text-overflow: ellipsis;
            color: black !important;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        .td-value {
            text-align: left !important;
            vertical-align: middle;
            word-wrap: break-word;
            color: black !important;
        }

        .td-value span {
            display: inline-block;
            overflow: hidden;
            padding-left: 0.06rem;
            word-wrap: break-word;
            color: black !important;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            background-color: #d3e8fd;
            padding: 0.08rem 0.06rem;
            border: 0.01rem solid #e8e8ea;
            display: none;
            overflow: hidden;
        }

        .div-td-content-more i {
            width: 0.15rem;
            height: 0.12rem;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 0.5rem;
            top: -.12rem;
        }

    </style>
</head>
<body>

<section class="content" id="app">
    <div class="div-td-content-more"><i></i></div>
    <div class="nav-tabs-custom oaReportNav">
    <!-- Tabs within a box -->
    <ul class="nav nav-tabs pull-right" style="margin-bottom: 10px;"v-cloak>
        <li :class="isActive('today')?'active':''"  @click="refreshData('staff','get_staff','today')"><a href="#sales-chart" data-toggle="tab">今日</a></li>
        <li :class="isActive(thisWeek)?'active':''"  @click="refreshData('staff','get_staff',thisWeek)"><a href="#sales-chart" data-toggle="tab">本周</a></li>
        <li :class="isActive(thisMonth)?'active':''" @click="refreshData('staff','get_staff',thisMonth)"> <a href="#sales-chart" data-toggle="tab">本月</a></li>
        <li :class="isActive('all')?'active':''" @click="refreshData('staff','get_staff')"> <a href="#sales-chart" data-toggle="tab">全部</a></li>
        <!--<div style="height: 25px;float: right;">-->
            <!--&lt;!&ndash;&lt;!&ndash;  <input class="form-control pull-left input-sm" type="text"&ndash;&gt;-->
                     <!--&lt;!&ndash;placeholder="公司名字关键字"&ndash;&gt;-->
                     <!--&lt;!&ndash;style="width: 120px;margin-left: 10px;"&ndash;&gt;-->
                     <!--&lt;!&ndash;v-model="companyNameKey"/>&ndash;&gt;-->
              <!--&lt;!&ndash;<button type="button" class="btn oaBtn btn-sm pull-left" style="margin-left: 10px;" @click="getList">查询</button>&ndash;&gt;&ndash;&gt;-->
            <!--&lt;!&ndash;&lt;!&ndash;<button type="button" class="btn oaBtn pull-right btn-sm" @click="goDetail(0,'add')"/>&ndash;&gt;&ndash;&gt;-->
            <!--&lt;!&ndash;&lt;!&ndash;新增回访</button>&ndash;&gt;&ndash;&gt;-->
            <!--<div class="clearfix"></div>-->
            <!--&lt;!&ndash; /.box-tools &ndash;&gt;-->
        <!--</div>-->
    </ul>
</div>

    <div class="box-body no-padding iframeH2" style="overflow: auto;" id="scrollDiv">
        <div id="progress" class="wyui-progress"></div>
        <table class="table table-hover table-bordered text-center table-striped">
            <thead>
            <tr>
                <th style="width: 80px;">公司</th>
                <th style="width: 60px;">部门</th>
                <th style="width: 60px;">岗位</th>
                <th style="width: 40px;">姓名</th>
                <th style="width: 60px;">在职状态</th>
                <th style="width: 60px;">入职时间</th>
                <th style="width: 40px;">性别</th>
                <th style="width: 60px;">电话</th>
                <th style="width: 60px;">在职天数</th>
                <th style="width: 60px;">直属领导</th>
                <th style="width: 60px;">回访状态</th>
                <th style="width: 140px;">负责区域</th>
                <th style="width: 60px;">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="(item,i) in list">
                <td>{{item.companyName}}</td>
                <td>{{item.departName}}</td>
                <td>{{item.roleName}}</td>
                <td>{{item.userName}}</td>
                <td>
                    <span v-if="item.jobState=='-2'">试岗</span>
                    <span v-else-if="item.jobState=='-1'">试用</span>
                    <span v-else-if="item.jobState=='0'">转正</span>
                    <span v-else-if="item.jobState=='1'">离职</span>
                    <span v-else="item.jobState=='2'">档案不全</span>
                </td>
                <td>{{item.entryDate}}</td>
                <td>{{item.sex=='0'?'男':'女'}}</td>
                <td>{{item.tel}}</td>
                <td>{{item.entryDays}}</td>
                <td>{{item.parentName}}</td>
                <td>
                    <span :style="item.status!='1'?'color:red;':''">{{item.status!='1'?'未回访':'已回访'}}</span>
                </td>
                <td style="text-align: left;">{{item.regionName}}</td>
                <td>
                    <a href="javascript:void(0);" @click="gotoDetail(item,'add')" v-if="item.status=='0'||item.status==''">
                        &nbsp;回访&nbsp;
                    </a>
                    <a href="javascript:void(0);" @click="gotoDetail(item,'update')" v-else>
                        &nbsp;修改&nbsp;
                    </a>

                    <!--<a href="javascript:void(0);" @click="removeById(item.id,i)">&nbsp;删除&nbsp;</a>-->
                </td>
            </tr>
            </tbody>
        </table>
        <div class="oa-pager text-center" style="margin-top: 5px;">
            共
            <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
            <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
            <span class="oa-pager-button" id="first">首页</span>
            <span class="oa-pager-button" id="prev">上一页</span>
            <span class="oa-pager-button" id="next">下一页</span>
            <span class="oa-pager-button" id="last">尾页</span>
        </div>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript">
    $(function () {
        $("body").on("click", ".td-value", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }

        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });

</script>
<script type="text/javascript">

    function refresh() {
        $.wyui.page.getByPage();
    }
    var app = new Vue({
        el: '#app',
        data: {
            dateTime:$.wyui.page.urlParams.dateTime,
            yesterday:new Date(new Date()-24*60*60*1000).Format("yyyy-MM-dd"),
            today:'today',
            thisMonth: new Date().Format("yyyy-MM"),
            thisWeek: new Date().Format("yyyy-MM-dd") + "-w",
            all:'',
            hour:new Date().getHours(),
            tab:[],
            currentUser: getCurrentUser(),
            companyNameKey: '',
            staff:{
                time:'today',
            },
            list: [],
            traineeList:[],
            quitList:[],
            id: '',
        },

        methods: {
            //tab中点击日期刷新对应数据
            refreshData:function (dataType,fun,time) {
                var that=this;
                that[dataType].time=time;
                that[fun]();
            },
            //获取tab
            getTab: function () {
                var that = this;
                var dateTime = new Date().Format("yyyyMM");

                for (var i = 0; i < 5; i++) {
                    dateTime = that.getLastEndMonth(dateTime);
                    that.tab.push(that.insert_flg(dateTime, "-", "4"))
                }
                console.log(that.tab)
            },
            isActive:function (item) {
                var that=this;
                if(that.staff.time==item){
                    return true;
                }
            },
            getLastEndMonth:function(beginYearMonth){
                var strYear = parseInt(beginYearMonth.substr(0,4),10);
                var strMonth = parseInt(beginYearMonth.substr(4,6),10);
                if(strMonth - 1 == 0){
                    strYear -= 1;
                    strMonth = 12;
                } else {
                    strMonth -= 1;
                }
                if(strMonth<10){
                    strMonth="0"+strMonth;
                }
                var monthstr = strYear+""+strMonth;
                return monthstr;
            },
            //格式化日期
            insert_flg: function (str, flg, sn,type) {
                var newstr = "";
                for (var i = 0; i < str.length; i += sn) {
                    var tmp = str.substring(i, i + sn);
                    newstr += tmp + flg;
                }
                newstr = newstr.substr(0, newstr.length - 1);
                var st1=newstr.substr(2,2);
                var st2=newstr.substr(5,2);
                var newstr3=st2+"/"+st1;
                var obj={str:newstr,time:newstr};
                return obj;
            },
//            goDetail: function (id, btnName) {
//                var H = $(window).height() - 50;
//                $.dialog({
//                    content: 'url:/page/returnVisit/detail.html?id=' + id + '&pageType=add',
//                    title: '新增员工回访',
//                    width: 400,
//                    height: H,
//                    max: true,
//                    min: true,
//                    lock: true
//                });
//            },
            gotoDetail: function (item, pageType) {
                var H = $(window).height() - 50;
                console.log(item.userId)
                var url='/page/returnVisit/detail.html?pageType='+pageType+'&&userId=' + item.userId;
                $.dialog({
                    content: 'url:'+url,
                    title: '回访员工信息',
                    width: 400,
                    height: H,
                    max: true,
                    min: true,
                    lock: true
                });
            },
//            del: function (id) {
//                var that = this;
//                var r=confirm("请确认是否删除");
//                if(r==true) {
//                    $.wyui.postMethod('/company/deleteById.json', {id: id}, function (r) {
//                        that.company = r;
//                        console.log(r.isOk)
//                        if (r.isOk){
//                            alert("删除成功")
//                            this.refresh();
//                        }else{
//                            alert("删除失败")
//                        }
//                    });}
//            },
            get_staff:function () {
                var that = this;
                $.wyui.page.queryParams.requestPage = 1;
                $.extend($.wyui.page.queryParams, {
                    "dateTime": that.staff.time
                });
                $.wyui.page.getByPage();
            }
        },
        mounted: function () {
            var that=this;
            //获取前5个月 拼接出日期筛选框
            //查看参数
            if(!that.id){
                that.id=getCurrentUser().id;
            }
            if(!that.dateTime){
                that.dateTime=new Date().Format("yyyy-MM-dd");
            }
//            //获取前5个月的tab数据
            this.getTab();
        }
    });
    //分页
    $.wyui.page.dataUrl = server.ip + "/returnVisit/getListInfo.json";
    $.extend($.wyui.page.queryParams, {
        "dateTime": app.staff.time
    });
    $.wyui.page.getByPage_callback = function (records) {
        console.log(records)
        app.list = records;
        document.getElementById("scrollDiv").scrollTop = 0;
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                app.list.push(list[i]);
            }
            isLoad = true;
        }
    };
</script>
</body>
</html>